package com.yc.sole.framework.mybatis.page;

import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.io.Serial;
import java.io.Serializable;

/**
 * @author yizuomin
 * @date 2022/11/23 15:04
 **/
@Data
public class BasePageReq<T extends Serializable> implements Serializable {

    @Serial
    private static final long serialVersionUID = 4144534662460837147L;
    /**
     * 页码
     */
    @NotNull
    private Integer page = 1;
    /**
     * 分页大小
     */
    @NotNull
    private Integer size = 10;
    /**
     * 查询条件
     */
    private T query;

    /**
     * 转换
     *
     * @return
     */
    public Paging<T> toPage() {
        return new Paging<>(page, size);
    }
}
